class DmsDocumentlocation {
  String? id;
  String? locationcode;
  String? locationname;
  String? areaId;
  String? areaName;
  String? remark;
  String? createUid;
  String? createName;
  String? createDate;
  String? writeUid;
  String? writeDate;

  DmsDocumentlocation({
    this.id,
    this.locationcode,
    this.locationname,
    this.areaId,
    this.areaName,
    this.remark,
    this.createUid,
    this.createName,
    this.createDate,
    this.writeUid,
    this.writeDate,
  });

  DmsDocumentlocation copyWith({
    String? id,
    String? locationcode,
    String? locationname,
    String? areaId,
    String? remark,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
  }) {
    return new DmsDocumentlocation(
      id: id ?? this.id,
      locationcode: locationcode ?? this.locationcode,
      locationname: locationname ?? this.locationname,
      areaId: areaId ?? this.areaId,
      remark: remark ?? this.remark,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
    );
  }

  @override
  String toString() {
    return '''DmsDocumentlocation{
      id: id,
      locationcode: locationcode,
      locationname: locationname,
      areaId: areaId,
      remark: remark,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is DmsDocumentlocation &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          locationcode == other.locationcode &&
          locationname == other.locationname &&
          areaId == other.areaId &&
          remark == other.remark &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate);

  factory DmsDocumentlocation.fromMap(Map<String, dynamic> map) {
    return new DmsDocumentlocation(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      locationcode: map['locationcode'] != false
          ? map['locationcode'].toString() as String?
          : "",
      locationname: map['locationname'] != false
          ? map['locationname'].toString() as String?
          : "",
      areaId: map['area_id'] != false
          ? map['area_id'][0].toString() as String?
          : "",
      areaName: map['area_id'] != false
          ? map['area_id'][1].toString() as String?
          : "",
      remark: map['remark'] != false ? map['remark'].toString() as String? : "",
      createUid: map['create_uid'] != false
          ? map['create_uid'][0].toString() as String?
          : "",
      createName: map['create_uid'] != false
          ? map['create_uid'][1].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'locationcode': this.locationcode,
      'locationname': this.locationname,
      'areaId': this.areaId,
      'remark': this.remark,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    print(this.areaId);
    List list = [
      if (this.locationcode != null && this.locationcode != '')
        ['locationcode', '=', this.locationcode],
      if (this.locationname != null && this.locationname != '')
        ['locationname', 'like', "%${this.locationname}%"],
      if (this.areaId != null && this.areaId != '')
        ['area_id', '=', int.parse(this.areaId!)],
    ] as List;
    // if(list.length==0){
    //   list.add(['id','!=',null]);
    // }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'locationcode': this.locationcode,
      'locationname': this.locationname,
      'area_id': this.areaId,
      'remark': this.remark,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
